<template>
    <div>
      <h1>I am A Apple</h1>
      <button @click="addOne">addOne</button>
      <button @click="minusOne">minusOne</button>
    </div>
</template>

<script>
    export default {
        name: 'Apple',
        data() {
            return {
                price:5
            }
        },
        methods: {
          addOne(){
            let vm=this
//            vm.$store.commit('increment',vm.price)  //这是commit mutations
            vm.$store.dispatch('increase',vm.price)   //这是dispatch actions
          },
          minusOne(){
            let vm=this
//            vm.$store.commit('decrement',vm.price)
            vm.$store.dispatch('decrease',vm.price)
          }
        },
        computed: {},
        created() {
            const vm = this
        },
    }
</script>

<style>
</style>
